package org.tuoren.official.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.tuoren.common.mybatis.core.page.PageQuery;
import org.tuoren.common.mybatis.core.page.TableDataInfo;
import org.tuoren.official.es.domain.SearchResultEs;
import org.tuoren.official.service.IProductAndNewsESService;


/**
 * 产品中心，新闻中心-ES搜索
 *
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/es/productAndNews")
public class ProductAndNewsESController {

    private final IProductAndNewsESService productAndNewsESService;

    @SaIgnore
    @GetMapping("/search")
    public TableDataInfo<SearchResultEs> searchAll(String keyword, PageQuery pageQuery) {
        return productAndNewsESService.searchAll(keyword, pageQuery);
    }
}
